package com.example.writting.ui.interview

import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.LinearLayoutManager
import com.example.writting.databinding.FragmentInterviewBinding

class InterviewFragment : Fragment() {

    private var _binding: FragmentInterviewBinding? = null
    private val binding get() = _binding!!

    private val questions = listOf(
        InterviewQuestion(
            "归零意识",
            "归零意识是念兹在兹，把爱民之情时时记在心上；归零意识是舍我其谁，把为民之责实实扛在肩上；归零意识是善作善战，把利民之举事事抓在手上。"
        )
    )

    private lateinit var adapter: InterviewAdapter

    override fun onCreateView(
        inflater: LayoutInflater,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View {
        _binding = FragmentInterviewBinding.inflate(inflater, container, false)
        return binding.root
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        setupRecyclerView()
    }

    private fun setupRecyclerView() {
        adapter = InterviewAdapter()
        binding.interviewList.layoutManager = LinearLayoutManager(requireContext())
        binding.interviewList.adapter = adapter
        adapter.updateItems(questions)
    }

    override fun onDestroyView() {
        super.onDestroyView()
        _binding = null
    }
} 